package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.core.integration.EduFormEnrollParamsBaseIntegration;
import com.jwsoft.manager.common.vo.eduFormEnrollParamsBase.EduFormEnrollParamsBaseVO;
import com.jwsoft.manager.common.vo.eduFormEnrollParamsBase.EduFormEnrollParamsBaseKeyVO;
import com.jwsoft.manager.common.vo.eduFormEnrollParamsBase.EduFormEnrollParamsBaseQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 动态表单配置表模板网关
 *
 * @author zjl
 * @since 2024-04-12
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "动态表单配置表模板", description = "动态表单配置表模板")
public class EduFormEnrollParamsBaseController {

    @Autowired
    public EduFormEnrollParamsBaseIntegration eduFormEnrollParamsBaseIntegration;

    @Operation(summary = "动态表单配置表模板分页查询",description = "动态表单配置表模板分页查询")
    @PostMapping(value = "/eduFormEnrollParamsBase0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduFormEnrollParamsBaseVO>> getList(@RequestBody @Validated EduFormEnrollParamsBaseQueryVO vo) {
        return AppResponse.successData(eduFormEnrollParamsBaseIntegration.getList(vo));
    }

    @Operation(summary = "动态表单配置表模板根据主键查询详情",description = "动态表单配置表模板根据主键查询详情")
    @PostMapping(value = "/eduFormEnrollParamsBase0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduFormEnrollParamsBaseVO> getById(@RequestBody @Validated EduFormEnrollParamsBaseKeyVO vo) {
        return AppResponse.successData(eduFormEnrollParamsBaseIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "动态表单配置表模板新增",description = "动态表单配置表模板新增")
    @PostMapping(value = "/eduFormEnrollParamsBase0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduFormEnrollParamsBaseVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduFormEnrollParamsBaseVO vo) {
        return AppResponse.successData(eduFormEnrollParamsBaseIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "动态表单配置表模板修改",description = "动态表单配置表模板修改")
    @PostMapping(value = "/eduFormEnrollParamsBase0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduFormEnrollParamsBaseVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduFormEnrollParamsBaseVO vo) {
        return AppResponse.successData(eduFormEnrollParamsBaseIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "动态表单配置表模板删除",description = "动态表单配置表模板删除")
    @PostMapping(value = "/eduFormEnrollParamsBase0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduFormEnrollParamsBaseKeyVO vo) {
        eduFormEnrollParamsBaseIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
